package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.TestSoulLock;
import com.itheima.mapper.TestSoulLockMapper;
import com.itheima.service.db.TestSoulLockService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class TestSoulLockServiceImpl implements TestSoulLockService {

    @Autowired
    private TestSoulLockMapper testSoulLockMapper;
    @Override
    public TestSoulLock findByUserId(Long userId, Long testSoulId) {
        //构建条件
        LambdaQueryWrapper<TestSoulLock> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TestSoulLock::getUserId,userId).eq(TestSoulLock::getTestSoulId,testSoulId);
        //查询
        return testSoulLockMapper.selectOne(wrapper);
    }
    //保存
    @Override
    public void save(TestSoulLock testSoulLock) {
        testSoulLockMapper.insert(testSoulLock);
    }
}
